package com.blunka.framework.client.ui;

import javax.swing.ImageIcon;
import javax.swing.JTabbedPane;

import com.blunka.framework.client.constants.ImageConstant;

/**
 * 属性操作面板
 * @author Administrator
 *
 */
@SuppressWarnings("serial")
public class OperatePanel extends JTabbedPane{

	private static OperatePanel operatePanel = new OperatePanel();

	/**
	 * 视图面板索引
	 */
	public static final int VIEW_PANE = 1;

	public static OperatePanel newInstance(){
		return operatePanel;
	}

	private OperatePanel(){
		ImageIcon icon = new ImageIcon(ImageConstant.TABLE_IMG);
		this.addTab("节点属性",icon,AttrPanel.newInstance());
	}

	/**
	 * 根据tab index索引隐藏tab
	 * @param tabIndex
	 */
	public void hiddenTab(int tabIndex){
		if(this.getTabCount() >1){
			this.remove(VIEW_PANE);
		}
		this.updateUI();
	}

	/**
	 * 根据tab index索引显示tab
	 * @param tabIndex
	 */
	public void showTab(int tabIndex){
		ImageIcon icon = new ImageIcon(ImageConstant.FIELD_IMG);
		this.addTab("视图编辑器",icon,ViewSqlPanel.newInstance());
		this.updateUI();

	}
}
